package com.qqt.csr.im.enums;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @Author: yang hao
 * @Date: 2024/10/14 11:18
 * @Description: 链接状态
 **/
@Getter
public enum ConnectStateEnum {


    DISCONNECT(0, "断开"),

    CONNECT(1, "连接"),

    ;

    private final Integer code;

    private final String desc;

    ConnectStateEnum(final Integer code, final String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static final ConnectStateEnum[] ENUMS = ConnectStateEnum.values();

    public static ConnectStateEnum matchEnum(Integer value) {
        return Arrays.stream(values()).filter(ele -> Objects.equals(ele.code, value)).findFirst().orElse(null);
    }

}
